#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>

namespace GEO {
	const double eps = 0.0000001;
#ifndef M_PI
	const double M_PI = 3.14159265358979323846;
#endif
	enum SIDE_STATE {OUT, IN, ON};


	typedef struct TPoint {
		double x, y;
	} TPoint;

	TPoint tPoint(double x, double y) {
		TPoint t;
		t.x = x;
		t.y = y;
		return t;
	}

	typedef struct TShape {
		int num;
		bool isClockwise;
		TPoint* points;
	} TShape;

	TPoint operator + (TPoint a, TPoint b) {
		TPoint res;
		res.x = a.x + b.x;
		res.y = a.y + b.y;
		return res;
	}

	TPoint operator - (TPoint a) {
		TPoint res;
		res.x = -a.x;
		res.y = -a.y;
		return res;
	}
	TPoint operator - (TPoint a, TPoint b) {
		TPoint res;
		res.x = a.x - b.x;
		res.y = a.y - b.y;
		return res;
	}
	TPoint operator * (double s, TPoint x) {
		TPoint res;
		res.x = s*x.x;
		res.y = s*x.y;
		return res;
	}
	TPoint operator / (TPoint x, double y) {
		TPoint res;
		res.x = x.x / y;
		res.y = x.y / y;
		return res;
	}
	bool eq(double x, double y) {return fabs(x-y)<eps;}
	bool operator == (TPoint a, TPoint b) {return eq(a.x, b.x) && eq(a.y, b.y);}

	std::ostream& operator<<(std::ostream& os, const TPoint& a) {
		return os << a.x << " " << a.y;
	}
	std::istream& operator>>(std::istream& is, TPoint& a) {
		return is >> a.x >> a.y;
	}

	double sqr(double x) {return x*x;}

	double norm2(TPoint a) {return sqr(a.x) + sqr(a.y);}

	double norm(TPoint a) {return sqrt(norm2(a));}

	TPoint normalizeTo(TPoint x, double len) {return len/norm(x)*x;}

	double cross(TPoint a, TPoint b){return a.x*b.y - b.x*a.y;}

	double dot(TPoint a, TPoint b) {return a.x*b.x + a.y*b.y;}

	double calArea(TShape poly) {
		double area = 0;
		for (int i=0; i<poly.num; ++i)
			area += cross(poly.points[i], poly.points[i+1]);
		return fabs(area/2);
	}

	SIDE_STATE inShape(TPoint a, TShape s) {
		double deg = 0, tot = 0;
		TPoint u, v;
		for (int i=0; i<s.num; ++i) {
			u = s.points[i] - a;
			v = s.points[i+1] - a;
			deg = asin(cross(u, v) / (norm(u)*norm(v)));
			if (norm2(s.points[i]-s.points[i+1]) > norm2(u) + norm2(v)) {
				if (deg < eps) deg = -M_PI - deg;
				else if (deg > eps) deg = M_PI - deg;
				else {
					if (s.isClockwise) deg = -M_PI;
					else deg = M_PI;
					return ON;
				}
			}
			tot += deg;
		}
		return (fabs(tot)>1)?IN:OUT;//deg = 0(out) or deg = -2PI(in) or deg = 2PI(in)
	}

	TPoint rotate(TPoint p, double alpha) {
		return tPoint(p.x*cos(alpha)-p.y*sin(alpha), p.x*sin(alpha)+p.y*cos(alpha));
	}

	TPoint getIntersection(TPoint a, TPoint b, TPoint u, TPoint v) {
		TPoint ret;
		double t1, t2;
		t1 = fabs(cross(u-a, v-a));
		t2 = fabs(cross(u-b, v-b));
		if (t1+t2 < eps) {
			t1 = dot(u-a, b-a);
			if (t1 > 0) ret = u;
			else ret = a;
		}
		else {
			ret.x = a.x+ t1/(t2+t1)*(b.x - a.x);
			ret.y = a.y+ t1/(t2+t1)*(b.y - a.y);
		}
		return ret;
	}

	double absoluteAngel(TPoint x) {
		TPoint v = tPoint(100, 0);
		double rad = asin(cross(v, x) / (norm(x)*norm(v)));
		if (dot(v, x) < 0) {
			if (rad < 0)
				rad = -M_PI - rad;
			else
				rad = M_PI - rad;
		}
		return rad;
	}

	double tangentAngel(TPoint p, TPoint center, double r) {
		return 2 * fabs(asin(r/norm(center-p)));
	}

	TPoint tangentPoint(TPoint p, TPoint center, double r, int pOrN) {
		double angel = fabs(asin(r/norm(center-p)));
		return p + rotate(center - p, (pOrN>0)?angel:-angel);
	}

	bool crossEach(TPoint a, TPoint b, TPoint u, TPoint v) {
		double c1 = cross(u-a, v-a);
		double c2 = cross(u-b, v-b);
		if (c1*c2 >= 0) return false;
		c1 = cross(a-u, b-u);
		c2 = cross(a-v, b-v);
		if (c1*c2 >= 0) return false;
		return true;
	}

	SIDE_STATE onLine(TPoint x, TPoint a, TPoint b) {
		double c1 = cross(b-a, x-a);
		if (fabs(c1) > eps) return OUT;
		if (fabs(norm(a-x) + norm(b-x) - norm(a-b)) < eps) return IN;
		return ON;
	}
}

using namespace std;
using namespace GEO;

TPoint s, t, lt, rb;
TShape rect;

int main(void)
{
	int n;
	cin >> n;
	rect.num = 4;
	rect.points = new TPoint[5];
	rect.isClockwise = true;
	for (int i=0; i<n; ++i) {
		int res = -1;
		cin >> s >> t >> lt >> rb;
		if (lt.x > rb.x) swap(lt.x, rb.x);
		if (lt.y < rb.y) swap(lt.y, rb.y);
		rect.points[0] = tPoint(lt.x, lt.y);
		rect.points[1] = tPoint(rb.x, lt.y);
		rect.points[2] = tPoint(rb.x, rb.y);
		rect.points[3] = tPoint(lt.x, rb.y);
		rect.points[4] = rect.points[0];
		for (int j=0; j<rect.num; ++j) {
			TPoint intersect = getIntersection(s, t, rect.points[j], rect.points[j+1]);
			if (onLine(intersect, s, t) == IN) {
				res = 0;
			}
			if (res == 0 && onLine(intersect, rect.points[j], rect.points[j+1]) == IN) {
				res = 1;
				break;
			}
			res = -1;
			if (crossEach(s, t, rect.points[j], rect.points[j+1])) {
				res = 1;
				break;
			}
		}
		if (res == -1) {
			if (inShape(s, rect) > OUT) res = 1;
			if (inShape(t, rect) > OUT) res = 1;
		}
// 		if (i>0) cout << endl;
		if (res == 1) cout << 'T';
		else cout << 'F';
		cout << endl;
	}
	return 0;
}
